# -*-coding=utf-8-*-
from django.db import models

class Period(models.Model):
	class Meta:
		verbose_name = "Período"
		verbose_name_plural = "Períodos"
	id = models.AutoField(primary_key=True)
	name = models.CharField(max_length=20, verbose_name="Nome")
	def __unicode__(self):
		return self.name

class Cycle(models.Model):
	class Meta:
		verbose_name = "Ciclo"
		verbose_name_plural = "Ciclos"
	number = models.IntegerField(verbose_name="Número", primary_key=True)
	def __unicode__(self):
		return str(self.number)

class Grade(models.Model):
	class Meta:
		verbose_name = "Ano"
		verbose_name_plural = "Anos"
	number = models.IntegerField(verbose_name="Número", primary_key=True)
	cycle = models.ForeignKey(Cycle, verbose_name="Ciclo")
	def __unicode__(self):
		return str(self.number)

class ScholarClass(models.Model):
	class Meta:
		verbose_name = "Turma"
		verbose_name_plural = "Turmas"
	unique_together = (("grade", "letter"),)
	grade = models.ForeignKey(Grade, verbose_name="Ano")
	letter = models.CharField(verbose_name="Letra", max_length=1)
	period = models.ForeignKey(Period, verbose_name="Período")
	def __unicode__(self):
		return str(self.grade) + self.letter
